<template>
  <div class="app-container">



    <el-container>
      <!-- <el-header>Header</el-header> -->
      <el-main style="padding: 40px;">
        <el-form>
          <el-form-item class="global-search-wrapper">
            <el-input placeholder="请输入搜索内容" class="global-search-input" size="large">
            </el-input>
            <el-button  type="primary"  size="large"  @click="handleQuery">搜索</el-button>
          </el-form-item>
        </el-form>
        
      </el-main>
    </el-container>

    <el-col :span="24">
      <el-card>
        <template>
          <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="标准规范层次" name="first">
              
              <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
                <div>
                  <el-form-item label="所属类目" prop="projectName">

                  </el-form-item>
                </div>
                <el-form-item label="项目名称" prop="projectName">
                  <el-input
                    v-model="queryParams.projectName"
                    placeholder="请输入项目名称"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>
                
                <el-form-item label="项目负责人" prop="pi">
                  <el-input
                    v-model="queryParams.pi"
                    placeholder="请输入项目负责人"
                    clearable
                    size="small"
                    @keyup.enter.native="handleQuery"
                  />
                </el-form-item>

                <el-form-item label="标准类型" prop="standardType">
                  <el-select v-model="queryParams.standardType" placeholder="请选择" clearable size="small">
                    <el-option v-for="dict in typeStandardLevelOptions" :key="dict.dictLabel" :label="dict.dictLabel" :value="dict.dictLabel" />
                  </el-select>
                </el-form-item>

                <!-- <el-form-item label="编制单位" prop="editCompany">
                  <el-input v-model="queryParams.editCompany" placeholder="请输入关键字" clearable size="small" @keyup.enter.native="handleQuery" />
                </el-form-item> -->

                <el-form-item label="办理人" prop="currOptName">
                  <el-input v-model="queryParams.currOptName" placeholder="请输入关键字" clearable size="small" @keyup.enter.native="handleQuery" />
                </el-form-item>
                
                <el-form-item label="关键字" prop="keyword">
                  <el-input v-model="queryParams.keyword" placeholder="请输入关键字" clearable size="small" @keyup.enter.native="handleQuery" />
                </el-form-item>

                <el-form-item label="开始时间">
                  <el-date-picker v-model="dateRange" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange"
                    range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
                </el-form-item>

                <el-form-item style="padding-left: 40px;">
                  <el-button  type="primary"  size="mini" @click="handleQuery">搜索</el-button>
                  <el-button size="mini" @click="resetQuery">重置</el-button>
                </el-form-item>
              </el-form>

              <el-row :gutter="10" class="mb8" style="margin: 0px;">
                <!-- <el-col :span="1.5">
                  <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['system:property:add']">新增</el-button>
                </el-col> -->
                <el-col :span="1.5">
                  <el-button
                    type="primary" plain
                    icon="el-icon-edit"
                    size="mini"
                    :disabled="single"
                    @click="handleUpdate"
                    v-hasPermi="['system:role:edit']"
                  >修改</el-button>
                </el-col>
                <el-col :span="1.5">
                  <el-button
                    type="primary" plain
                    icon="el-icon-delete"
                    size="mini"
                    :disabled="multiple"
                    @click="handleDelete"
                    v-hasPermi="['system:role:remove']"
                  >删除</el-button>
                </el-col>
                <el-col :span="1.5">
                  <el-button
                    icon="el-icon-download"
                    size="mini"
                    @click="handleExport"
                    v-hasPermi="['system:role:export']"
                  >导出</el-button>
                </el-col>
                <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
              </el-row>

              <br>

              <div v-for="(item, index) in mList" :key="index" class="card-custom-background">
                <el-card class="box-card" >
                  <div class="card-custom-body">
                    <span class="card-custom-header link-type" @click="handleView(item.nid)">{{item.projectName}}</span>
                    <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
                    <div class="custom-abstract-wrapper">
                      <span class="custom-abstract-title">主要内容： </span>
                      <span class="custom-abstract-content">{{item.infosDesc}}</span>
                    </div>
                    <div class="keyword-custom-body" v-if="item.keywords != null" >
                      <span class="keyword-custom-title">关键词：</span>
                      <span class="keyword-custom-content-wrapper" v-for="obj in item.keywords" >
                        <a class="keyword-custom-content link-type">
                          {{obj}}
                        </a>
                      </span>
                    </div>
                  </div>
                  <!-- <div v-for="o in 4" :key="o" class="text item">
                    {{'列表内容 ' + o }}
                  </div> -->
                </el-card>
                <br>
              </div>

              

              <pagination v-show="total>0" 
                :total="total" 
                :page.sync="queryParams.pageNum" 
                :limit.sync="queryParams.pageSize"
                :page-sizes="[5, 10, 20, 30]"
                @pagination="getList" />


            </el-tab-pane>
            <el-tab-pane label="功能序列" name="second">功能序列</el-tab-pane>
            <el-tab-pane label="专业门类" name="third">专业门类</el-tab-pane>

            <!-- 添加或修改立项通知（市监）对话框 -->
              <el-dialog :title="title" :visible.sync="open" width="1080px" append-to-body>

                

                <el-card class="box-card" v-if="steps == '2' || steps == '3'">
                  <div slot="header" class="clearfix">
                    <span style="font-size: 16px;font-weight: 600;">项目基础信息</span>
                  </div>
                  <el-form ref="form" :model="form" :rules="rules" label-width="120px">
                    <el-col :span="12">
                      <el-form-item label="项目名称" prop="projectName">
                        <el-input v-model="form.projectName" placeholder="项目名称" />
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="项目关键词" prop="keyword">
                        <el-input v-model="form.keyword" placeholder="项目关键词，多个关键词用，隔开" />
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="专业门类选择" prop="majorValue">
                        <el-cascader style="width: 380px;" v-model='majorValue' :options="majorOptions" @change="handleChangeMajor"></el-cascader>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="功能序列选择" prop="functionValue">
                        <el-cascader style="width: 380px;" v-model='functionValue' :options="functionOptions" @change="handleChangeFunction"></el-cascader>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="标准性质" prop="standardNature">
                        <el-select style="width: 380px;" v-model="form.standardNature" placeholder="请选择">
                          <el-option v-for="dict in typeStandardNatureOptions" :key="dict.dictValue" :label="dict.dictLabel"
                            :value="dict.dictValue" />
                        </el-select>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="标准状态" prop="standardStatus">
                        <el-select style="width: 380px;" v-model="form.standardStatus" placeholder="请选择">
                          <el-option v-for="dict in typeStandardStatusOptions" :key="dict.dictValue" :label="dict.dictLabel"
                            :value="dict.dictValue" />
                        </el-select>
                      </el-form-item>
                    </el-col>
                  </el-form>
                </el-card>

                <el-card class="box-card" style="margin-top: 20px;" v-if="steps == '2'">
                  <div slot="header" class="clearfix">
                    <span style="font-size: 16px;font-weight: 600;">市场监管局标准规范立项信息</span>
                  </div>
                  <el-form ref="form" :model="form" :rules="rules" label-width="120px">
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="制定或修订" prop="tp">
                          <el-radio-group v-model="form.tp" size="small">
                            <el-radio-button label="制定"></el-radio-button>
                            <el-radio-button label="修订"></el-radio-button>
                          </el-radio-group>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="被修订标准号" prop="standardNo">
                          <el-input v-model="form.standardNo" placeholder="被修订标准号开" />
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="项目承担单位" prop="hostUnit">
                          <el-input v-model="form.hostUnit" placeholder="项目承担单位" />
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="计划完成时间" prop="pctm">
                          <el-date-picker v-model="form.pctm" type="date" placeholder="选择日期">
                          </el-date-picker>
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="项目负责人" prop="pi">
                          <el-input v-model="form.pi" placeholder="项目负责人" />
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="职务" prop="post">
                          <el-input v-model="form.post" placeholder="职务" />
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="电话" prop="tel">
                          <el-input v-model="form.tel" placeholder="电话" />
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="电子邮件" prop="email">
                          <el-input v-model="form.email" placeholder="电子邮件" />
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="参与起草单位" prop="partUnit">
                          <el-input v-model="form.partUnit" placeholder="参与起草单位名称" />
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="失效时间" prop="expire">
                          <el-date-picker v-model="form.expire" type="date" placeholder="选择日期">
                          </el-date-picker>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-col :span="24">
                      <h4>>>>主要起草人（前五位，按在起草工作中的贡献度排名）</h4>
                    </el-col>
                    <el-table :data="tableData" style="width: 100%" border>
                      <el-table-column prop="dname" label="姓名" width="180">
                      </el-table-column>
                      <el-table-column prop="dunit" label="工作单位" width="180">
                      </el-table-column>
                      <el-table-column prop="dpost" label="职务职称">
                      </el-table-column>
                      <el-table-column prop="dprogress" label="专业">
                      </el-table-column>
                      <el-table-column prop="divide" label="项目分工">
                      </el-table-column>
                    </el-table>
                    <el-col :span="24">
                      <h4>>>>目的、意义及必要性</h4>
                    </el-col>
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.goalDesc" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-col :span="24">
                      <h4>>>>国内外情况简要说明</h4>
                    </el-col>
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.infosDesc" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-col :span="24">
                      <h4>>>>范围和主要技术内容</h4>
                    </el-col>
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.techDesc" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-col :span="24">
                      <h4>>>>可行性分析</h4>
                    </el-col>
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.analysisDesc" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-col :span="24">
                      <h4>>>>是否涉及专利等知识产权问题</h4>
                    </el-col>
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.propertyDesc" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-form>
                </el-card>

                <el-card class="box-card" style="margin-top: 20px;" v-if="steps == '2'">
                  <div slot="header" class="clearfix">
                    <span style="font-size: 16px;font-weight: 600;">项目承担单位意见</span>
                  </div>
                  <el-form ref="form" :model="form" :rules="rules" label-width="120px" v-if="steps == '2'">
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.hostUnitOpinion" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-form>
                </el-card>

                <el-card class="box-card" style="margin-top: 20px;" v-if="steps == '2'">
                  <div slot="header" class="clearfix">
                    <span style="font-size: 16px;font-weight: 600;">行政主管部门意见</span>
                  </div>
                  <el-form ref="form" :model="form" :rules="rules" label-width="120px" v-if="steps == '2'">
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.authUnitOpinion" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-form>
                </el-card>

                <el-card class="box-card" style="margin-top: 20px;" v-if="steps == '3'">

                  <div slot="header" class="clearfix">
                    <span style="font-size: 16px;font-weight: 600;">市住建局标准规范立项信息</span>
                  </div>
                  <el-form ref="form" :model="form" :rules="rules" label-width="120px">
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="项目英文名称" prop="enName">
                          <el-input v-model="form.enName" placeholder="项目英文名称" />
                        </el-form-item>
                      </el-col>

                      <el-col :span="12">
                        <el-form-item label="制定或修订" prop="tp">
                          <el-radio-group v-model="form.tp" size="small">
                            <el-radio-button label="制定"></el-radio-button>
                            <el-radio-button label="修订"></el-radio-button>
                          </el-radio-group>
                        </el-form-item>
                      </el-col>

                      <el-col :span="12">
                        <el-form-item label="被修订标准号" prop="standardNo">
                          <el-input v-model="form.standardNo" placeholder="被修订标准号" />
                        </el-form-item>
                      </el-col>

                      <el-col :span="12">
                        <el-form-item label="项目主编单位" prop="hostUnit">
                          <el-input v-model="form.hostUnit" placeholder="项目主编(申报)单位" />
                        </el-form-item>
                      </el-col>

                      <el-col :span="24">
                        <el-form-item label="主编单位资格条件情况说明" prop="hostUnitDesc">
                          <el-input v-model="form.hostUnitDesc" type="textarea" rows="3" placeholder="（含主编或参编的本市在编工程建设标准制修订项目计划进度完成情况，若有）"></el-input>
                        </el-form-item>
                      </el-col>

                      <el-col :span="24">
                        <el-form-item label="参编单位" prop="partUnit">
                          <el-input v-model="form.partUnit" placeholder="参编单位" />
                        </el-form-item>
                      </el-col>

                      <el-col :span="24" v-if="form.tp == '修订'">
                        <el-form-item label="申报单位是" prop="isHostUnit">
                          <el-tooltip class="item" effect="dark" content="修订项目填写" placement="right">
                            <el-radio-group v-model="form.isHostUnit">
                              <el-radio v-for="dict in stdDeclareUnitOptions" :key="dict.dictValue" :label="dict.dictValue">{{dict.dictLabel}}</el-radio>
                            </el-radio-group>
                          </el-tooltip>
                        </el-form-item>
                      </el-col>

                      <el-col :span="24" v-if="form.isHostUnit == '1' || form.isHostUnit == '2'">
                        <el-form-item label="原主编单位意见" prop="exOpinion">
                          <el-input v-model="form.exOpinion" type="textarea" placeholder="(若非原主编单位)"></el-input>
                        </el-form-item>
                      </el-col>

                      <el-col :span="12">
                        <el-form-item label="计划完成时间" prop="pctm">
                          <el-date-picker v-model="form.pctm" type="date" placeholder="选择日期">
                          </el-date-picker>
                        </el-form-item>
                      </el-col>

                      <el-col :span="12">
                        <el-form-item label="项目负责人" prop="pi">
                          <el-input v-model="form.pi" placeholder="项目负责人" />
                        </el-form-item>
                      </el-col>

                      <el-col :span="12">
                        <el-form-item label="职务" prop="post">
                          <el-input v-model="form.post" placeholder="职务" />
                        </el-form-item>
                      </el-col>

                      <el-col :span="12">
                        <el-form-item label="电话" prop="tel">
                          <el-input v-model="form.tel" placeholder="电话" />
                        </el-form-item>
                      </el-col>

                      <el-col :span="12">
                        <el-form-item label="失效时间" prop="expire">
                          <el-date-picker v-model="form.expire" type="date" placeholder="选择日期">
                          </el-date-picker>
                        </el-form-item>
                      </el-col>

                    </el-row>

                    <el-col :span="24">
                      <h4>>>>有无国家、本省本市法律法规、规范、政策和重点工作部署相关依据的情况说明</h4>
                    </el-col>
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.lawDesc" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-col :span="24">
                      <h4>>>>目的、意义及必要性</h4>
                    </el-col>

                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.goalDesc" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-col :span="24">
                      <h4>>>>有无相关国家标准、行业标准、地方标准情况说明</h4>
                    </el-col>
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.stdDesc" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-col :span="24">
                      <h4>>>>有无团体标准、本企业编制的企业标准或本市政府发布的技术性指导文件的情况说明</h4>
                    </el-col>
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.techDesc" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-col :span="24">
                      <h4>>>>与国内相关标准对标情况的综合说明（含港澳台地区，可将香港等粤港澳大湾区及国内相关重点城市或地区作为对标重点）</h4>
                    </el-col>
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.countryDesc" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-col :span="24">
                      <h4>>>>与国际相关标准对标情况的综合说明（可将欧洲、英国、日本、新加坡等国家和地区作为对标重点，但不限于上述国家和地区）</h4>
                    </el-col>
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.foreignDesc" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-col :span="24">
                      <h4>>>>对标或借鉴的国际、国外或区域性（含港澳台地区和国内重点城市）先进标准名称、编号清单</h4>
                    </el-col>
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.foreignStdList" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-col :span="24">
                      <h4>>>>涵盖范围和主要内容说明</h4>
                    </el-col>
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.infosDesc" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-col :span="24">
                      <h4>>>>涉及的科研成果鉴定、验证或认可情况说明</h4>
                    </el-col>
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.achievementDesc" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-col :span="24">
                      <h4>>>>是否涉及专利相关事项说明</h4>
                    </el-col>
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.propertyDesc" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-col :span="24">
                      <h4>>>>先进性、创新性和因地制宜等情况说明</h4>
                    </el-col>
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.advanceDesc" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-row>
                      <el-col :span="24">
                        <el-form-item label="自评价(可多选)" prop="selfEvla">
                          <el-checkbox-group v-model="selfEvlaOpt" @change="handleCheckedSelfEvla">
                            <el-checkbox label="填补本市空白">填补本市空白</el-checkbox>
                            <el-checkbox label="填补国内空白">填补国内空白（不含港澳台地区）</el-checkbox>
                            <el-checkbox label="可达到国内领先水平">可达到国内领先水平</el-checkbox>
                            <el-checkbox label="可达到国际先进水平">可达到国际先进水平</el-checkbox>
                          </el-checkbox-group>
                        </el-form-item>
                      </el-col>
                    </el-row>

                    <el-col :span="24">
                      <h4>>>>工作经费安排情况说明</h4>
                    </el-col>
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.fundsDesc" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-form>
                </el-card>

                <el-card class="box-card" style="margin-top: 20px;" v-if="steps == '3'">
                  <div slot="header" class="clearfix">
                    <span style="font-size: 16px;font-weight: 600;">主编单位意见</span>
                  </div>
                  <el-form ref="form" :model="form" :rules="rules" label-width="120px">
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.hostUnitOpinion" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-form>
                </el-card>

                <el-card class="box-card" style="margin-top: 20px;" v-if="steps == '3'">
                  <div slot="header" class="clearfix">
                    <span style="font-size: 16px;font-weight: 600;">政府组织起草部门/业务归口行政主管部门意见</span>
                  </div>
                  <el-form ref="form" :model="form" :rules="rules" label-width="120px">
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.authUnitOpinion" type="textarea" placeholder="（有自行组织专家评审的请附专家评审意见）"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-form>
                </el-card>

                <el-card class="box-card" style="margin-top: 20px;" v-if="steps == '3'">
                  <div slot="header" class="clearfix">
                    <span style="font-size: 16px;font-weight: 600;">深圳市住房和建设局（市工程建设标准统筹管理部门）意见</span>
                  </div>
                  <el-form ref="form" :model="form" :rules="rules" label-width="120px">
                    <el-row>
                      <el-col :span="24">
                        <el-form-item label-width="0px;">
                          <el-input v-model="form.mainUnitOpinion" type="textarea" placeholder="请输入内容"></el-input>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-form>
                </el-card>

                <el-card class="box-card" style="margin-top: 20px;" v-if="viewOpt">
                  <div slot="header" class="clearfix">
                    <span style="font-size: 16px;font-weight: 600;">部门办理意见</span>
                  </div>
                  <el-form label-width="120px">
                    <el-row v-for="opn in opinionList" :key="opn.id">
                      <el-col :span="24">
                        <el-form-item :label="opn.node">
                          <el-input placeholder="" type="textarea" :value="opn.opn" readonly></el-input>
                          <div style="position: absolute;right:20px;margin-top: -30px;">
                            <span>{{opn.name}}</span>
                            <span style="margin-left: 20px;">{{opn.st}}</span>
                          </div>
                        </el-form-item>
                      </el-col>
                    </el-row>
                  </el-form>
                </el-card>


              </el-dialog>

          </el-tabs>
        </template>
      </el-card>
    </el-col>

    

  </div>
</template>

<script>
import { listProperty, getM, delM, addM, updateM, exportM } from "@/api/result/property";
import {
    listNotice,
    getNotice,
    delNotice,
    addNotice,
    updateNotice,
    exportNotice
  } from '@/api/standard/notice'

import {
  getFlow,
  selectOptions,
  saveFlow,
  listOpinion
} from "@/api/standard/flow";

import '@/assets/styles/search.scss'
import { listSearch } from '@/api/result/search'

import {optionSelect} from "@/api/system/dict/data";


export default {
  name: "M",
  data() {
    return {
      // 遮罩层
      loading: false,
      forbidden: true,
      //默认选中
      activeName: 'first',
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 弹出层标题
      title: '',
      // 是否查看页面
      viewOpt: false,
      // 是否显示弹出层
      open: false,
      // 立项通知（市监）表格数据
      mList: [],
      tableData: [],
      // 日期范围
      dateRange: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 5,
        projectName: null,
        processStatus: null,
        operatorName: null,
        pi: null,
        currOptName: null,
        standardType: null,
        auditCompany: null,
        editCompany: null,
        keyword: null
      },
      work: {
        todo: 8,
        done: 24,
        doing: 17,
        back: 3,
      },
      //当前步骤0,1,2,3
      steps: 0,

      //专业门类选择
      majorValue: [],
      majorOptions: [],
      //功能序列选择
      functionValue: [],
      functionOptions: [],
      // 自我评价
      selfEvlaOpt: [],
      // 类型数据字典
      typeOptions: [],
      typeStandardNatureOptions: [],
      typeStandardStatusOptions: [],
      typeStandardLevelOptions: [],
      typeStandardUnitOptions: [],
      // 申报单位
      stdDeclareUnitOptions: [],
      standardNature: null,
      standardStatus: null,
      //标准类型
      standardType: null,
      //单位
      unitType: null,
      //是否修改页面
      lastStep: true,

      // 表单参数
      form: {},
      // 表单校验
      rules: {
        userid: [{
          required: true,
          message: '用户id不能为空',
          trigger: 'blur'
        }],
      }
    }
  },
  created() {
    this.getList();
    //立项通知流程状态
    this.getDicts('standard_notice_type').then(response => {
      this.typeOptions = response.data
    });
    //标准性质
    this.getDicts('standard_nature_type').then(response => {
      this.typeStandardNatureOptions = response.data
    });
    //标准状态
    this.getDicts('standard_status_type').then(response => {
      this.typeStandardStatusOptions = response.data
    });
    //专业门类选择
    optionSelect("standard_major_type").then(response => {
      this.majorOptions = this.cascaderNormalizer(response.data)
    });
    //功能序列选择
    optionSelect("standard_function_type").then(response => {
      this.functionOptions = this.cascaderNormalizer(response.data)
    });
    //标准规范立项单位
    this.getDicts("standard_project_unit").then(response => {
      this.typeStandardUnitOptions = response.data
    });
    //标准规范种类
    this.getDicts("standard_level_type").then(response => {
      this.typeStandardLevelOptions = response.data
    });
    //申报单位
    this.getDicts("standard_declare_unit").then(response => {
      this.stdDeclareUnitOptions = response.data
    });
  },
  methods: {
    /** 查询立项通知（市监）列表 */
    getList() {
      this.loading = true
      listSearch(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
        this.mList = response.rows
        for (var i = 0; i < this.mList.length; i++) {
          if (this.mList[i].keyword != null) {
            this.mList[i].keywords = this.mList[i].keyword.split(",");
          }
        }
        console.log(this.mList);
        this.total = response.total
        this.loading = false
      })
    },

    //点击页签触发事件
    handleClick(tab, event) {
      console.log(tab, event);
    },

    // 标准规范种类字典翻译
    stdTpFormat(row, column) {
      return this.selectDictLabel(this.typeStandardLevelOptions, row.stdTp);
    },

    // 审核单位字典翻译
    stdUnitFormat(row, column) {
      return this.selectDictLabel(this.typeStandardUnitOptions, row.stdUnit);
    },

    // 取消按钮
    cancel() {
      this.open = false
      this.steps = 0
      this.lastStep = true
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        nid: null,
        userid: null,
        wid: null,
        nname: null,
        eunit: null,
        pctm: null,
        ld: null,
        partUnit: null,
        ldp: null,
        isHostUnit: null,
        ldu: null,
        projectName: null,
        keyword: null,
        majorValue: null,
        functionValue: null,
        standardNature: null,
        standardStatus: null,
        enName: null,
        tp: null,
        standardNo: null,
        hostUnit: null,
        planTime: null,
        pi: null,
        post: null,
        tel: null,
        email: null,
        hostUnitOpinion: null,
        authUnitOpinion: null,
        mainUnitOpinion: null,
        stdTp: null,
        exOpinion: null,
        stdUnit: null,
        goalDesc: null,
        wStatus: "0",
        infosDesc: null,
        techDesc: null,
        analysisDesc: null,
        propertyDesc: null,
        hostUnitDesc: null,
        lawDesc: null,
        stdDesc: null,
        countryDesc: null,
        foreignDesc: null,
        foreignStdList: null,
        achievementDesc: null,
        advanceDesc: null,
        fundsDesc: null,
        selfEvla: null
      }
      this.resetForm('form')

      // 重置的时候,数组都要注意置空
      this.majorValue = null
      this.functionValue = null
      this.selfEvlaOpt = null
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm('queryForm')
      this.dateRange = null;
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.nid)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.open = true
      this.steps = 0
      this.lastStep = true
      this.title = '新增立项通知'
    },
    /** 查看操作 */
    handleView(nid) {
      // console.log(row);
      this.steps = 0
      this.reset()
      // const nid = row.nid || this.ids
      getNotice(nid).then(response => {
        this.functionValue = response.data.functionValue == null ? [] : response.data.functionValue.split(",").map(
          Number);
        this.majorValue = response.data.majorValue == null ? [] : response.data.majorValue.split(",").map(Number);
        this.selfEvlaOpt = response.data.selfEvla == null ? [] : response.data.selfEvla.split(",").map(String);
        if (response.data.stdUnit == '深圳市住房和建设局') {
          this.steps = 3
        } else {
          this.steps = 2
        }
        this.form = response.data
        this.open = true
        this.title = '查看立项通知'
        // 查看标记
        this.viewOpt = true

        //加载办理意见列表
        this.opinionInfos();
      })
    },
    // 流程记录
    opinionInfos() {
      var tableName = 'tb_nop_m'
      listOpinion(this.form.nid, tableName).then(response => {
        // console.log(response.data)
        this.opinionList = response.data
      });
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      //避免切换（住建/市监）时报错
      this.steps = 0
      this.reset()
      const nid = row.nid || this.ids
      getNotice(nid).then(response => {
        this.functionValue = response.data.functionValue == null ? [] : response.data.functionValue.split(",").map(Number);
        this.majorValue = response.data.majorValue == null ? [] : response.data.majorValue.split(",").map(Number);
        this.selfEvlaOpt = response.data.selfEvla == null ? [] : response.data.selfEvla.split(",").map(String);

        this.lastStep = false

        if (response.data.stdUnit=='深圳市住房和建设局') {
          this.steps = 3
        } else {
          this.steps = 2
        }

        this.form = response.data
        this.open = true

        this.title = '修改立项通知'
      })
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          if (this.form.nid != null) {
            updateM(this.form).then(response => {
              this.msgSuccess('修改成功')
              this.open = false
              this.getList()
            })
          } else {
            addM(this.form).then(response => {
              this.msgSuccess('新增成功')
              this.open = false
              this.getList()
            })
          }
        }
      })
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const nids = row.nid || this.ids
      this.$confirm('是否确认删除立项通知编号为"' + nids + '"的数据项?', '警告', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function() {
        return delNotice(nids)
      }).then(() => {
        this.getList()
        this.msgSuccess('删除成功')
      })
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams
      this.$confirm('是否确认导出所有立项通知数据项?', '警告', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(function() {
        return exportNotice(queryParams)
      }).then(response => {
        this.download(response.msg)
      })
    },
    /** 下一步按钮操作 */
    next() {
      if (this.steps == 0 && this.form.stdTp == null) {
        this.$message.error('请选择标准规范种类');
        return false;
      }

      if (this.steps == 1 && this.form.stdUnit == null) {
        this.$message.error('请选择标准规范立项单位');
        return false;
      }

      if (this.form.stdUnit == '深圳市住房和建设局') {
        // 跳转住建局页面
        this.steps = 3;
      } else {
        if (this.steps++ > 3) this.steps = 0;
      }

    },
    back() {
      if (this.steps == 3) {
        this.steps = 1
      } else {
        if (this.steps-- < 0) this.steps = 0;
      }
    },
    skip() {
      if (this.steps++ > 3) this.steps = 3;
    },
    handleChangeMajor(value) {
      //console.log(value.length);
      var x = '';
      for (var i = 0; i < value.length; i++) {
        if (i == 0) {
          x = value[i];
        } else {
          x = x + "," + value[i];
        }
      }
      this.form.majorValue = x;
    },
    handleChangeFunction(value) {
      //console.log(value.length);
      var x = '';
      for (var i = 0; i < value.length; i++) {
        if (i == 0) {
          x = value[i];
        } else {
          x = x + "," + value[i];
        }
      }
      this.form.functionValue = x;
    },
    // 自我评价多选
    handleCheckedSelfEvla(value){
      // console.log(value)
      var x = '';
      for (var i = 0; i < value.length; i++) {
        if (i == 0) {
          x = value[i];
        } else {
          x = x + "," + value[i];
        }
      }
      this.form.selfEvla = x;
    },
  }
};
</script>
<style scoped>
  .app-container {
     padding: 0px;
  }
  .bg-purple {
    background: #F8F8F9;
    height: 140px;
    text-align: center;
    padding-top: 15px;
    border: 1px solid #DFE6EB;
  }

  .span-title {
    color: #909399;
  }

  .radio-group-text span {
    font-size: 18px;
  }

    .text {
    font-size: 14px;
  }

  .item {
    margin-bottom: 18px;
  }

  .clearfix:before,
  .clearfix:after {
    display: table;
    content: "";
  }
  .clearfix:after {
    clear: both
  }

  .box-card {
    width: 100%;
  }

  .pagination-container {
    margin-bottom: 40px;
  }


</style>